/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.dto.sqlServer;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author zhangYY
* @date 2024-01-13
**/
@Entity
@Data
@Table(name="plc_lay_up")
public class PlcLayUp implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`ip`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "ip")
    private String ip;

    @Column(name = "`port`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "port")
    private Integer port;

    @Column(name = "`plc_status`")
    @ApiModelProperty(value = "plc状态")
    private Integer plcStatus;

    @Column(name = "`content`")
    @ApiModelProperty(value = "内容")
    private String content;

    @Column(name = "`has_paller`")
    @ApiModelProperty(value = "有无载")
    private Integer hasPallet;

    @Column(name = "`button_signal`")
    @ApiModelProperty(value = "按钮信号")
    private Integer buttonSignal;

    @Column(name = "`start_signal`")
    @ApiModelProperty(value = "启动信号")
    private Integer startSignal;

    @Column(name = "`error_msg`")
    @ApiModelProperty(value = "错误信息")
    private String errorMsg;

    @Column(name = "`create_time`")
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;

    @Column(name = "`update_time`")
    @ApiModelProperty(value = "更新时间")
    private Timestamp updateTime;

    public void copy(PlcLayUp source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
